home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue68 / Alfresco / TstChStm.dpr < prev    next >
Encoding:
Text File  |  2001-02-16  |  942 b   |  42 lines

  1. program TstChStm;
  2.  
  3. uses
  4.   SysUtils,
  5.   Classes,
  6.   AAChrStm in 'AAChrStm.pas';
  7.  
  8. var
  9.   InStm  : TFileStream;
  10.   OutStm : TFileStream;
  11.   InChStm  : TaaInCharStream;
  12.   OutChStm : TaaOutCharStream;
  13.   Ch : char;
  14.   SmallBuf : array [0..19] of byte;
  15. begin
  16.   InStm := nil;
  17.   InChStm := nil;
  18.   OutStm := nil;
  19.   OutChStm := nil;
  20.   try
  21.     InStm := TFileStream.Create('c:\aaclass.log', fmOpenRead+fmShareDenyNone);
  22.     InChStm  := TaaInCharStream.Create(InStm);
  23.     OutStm := TFileStream.Create('c:\test.out', fmCreate);
  24.     OutChStm := TaaOutCharStream.Create(OutStm);
  25.    {OutChStm.EndOfLine := eolLF;}
  26.  
  27.     InChStm.Read(SmallBuf, sizeof(SmallBuf));
  28.     OutChStm.Write(SmallBuf, sizeof(SmallBuf));
  29.  
  30.     Ch := InChStm.GetChar;
  31.     while (Ch <> #0) do begin
  32.       OutChStm.PutChar(Ch);
  33.       Ch := InChStm.GetChar;
  34.     end;
  35.   finally
  36.     OutChStm.Free;
  37.     OutStm.Free;
  38.     InChStm.Free;
  39.     InStm.Free;
  40.   end;
  41. end.
  42.